package com.lxz.aimedicalassistantbackend.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lxz.aimedicalassistantbackend.entity.Appointment;
import com.lxz.aimedicalassistantbackend.mapper.AppointmentMapper;
import com.lxz.aimedicalassistantbackend.service.AppointmentService;
import org.springframework.stereotype.Service;

/**
 * @Author: 小新
 * @Date: 2025/5/2 17:03
 * @Description:
 * @Version: v1.0
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment>
        implements AppointmentService {

    /**
     * 查看订单是否存在
     * @param appointment
     * @return
     */
    @Override
    public Appointment getOne(Appointment appointment) {
        Long id = appointment.getId();
        String username = appointment.getUsername();
        String idCard = appointment.getIdCard();
        String department = appointment.getDepartment();
        String date = appointment.getDate();
        String time = appointment.getTime();

        QueryWrapper<Appointment> queryWrapper = new QueryWrapper<>();
        queryWrapper
                .eq("username",username)
                .eq("id_card",idCard)
                .eq("department",department)
                .eq("date",date)
                .eq("time",time);
       return this.getOne(queryWrapper);
    }
}
